import fetch from '../../../utils/fetch'

export function page (query) {
  return fetch({
    url: '/api/auth/user/page',
    method: 'get',
    params: query
  })
}

export function insertUserAndRole (query) {
  return fetch({
    url: '/api/auth/user/insertUserAndRole',
    method: 'post',
    params: query
  })
}

export function getRoleAndResourceByUserId (query) {
  return fetch({
    url: '/api/auth/user/getRoleAndResourceByUserId',
    method: 'get',
    params: query
  })
}

export function getResourceByUserId (query) {
  return fetch({
    url: '/api/auth/user/getResourceByUserId',
    method: 'get',
    params: query
  })
}

export function getUserAndRoleAndMenuByUserId (query) {
  return fetch({
    url: '/api/auth/user/getUserAndRoleAndMenuByUserId',
    method: 'get',
    params: query
  })
}

export function getMenuByUserName (query) {
  return fetch({
    url: '/api/auth/jwt/me',
    method: 'get'
  })
}

export function getRoleByUserId (query) {
  return fetch({
    url: '/api/auth/user/getRoleByUserId',
    method: 'get',
    params: query
  })
}
export function getRoleAll (query) {
  return fetch({
    url: '/api/auth/user/getRoleAll',
    method: 'get',
    params: query
  })
}

export function addObj (obj) {
  return fetch({
    url: '/api/auth/user',
    method: 'post',
    data: obj
  })
}

export function getObj (id) {
  return fetch({
    url: '/api/auth/user/' + id,
    method: 'get'
  })
}

export function delObj (id) {
  return fetch({
    url: '/api/auth/user/' + id,
    method: 'delete'
  })
}

export function putObj (id, obj) {
  return fetch({
    url: '/api/auth/user/' + id,
    method: 'put',
    data: obj
  })
}
